package com.autotest.sync.android;

import com.autotest.sync.Config;
import com.autotest.sync.stf.Stf;
import com.autotest.sync.utils.ThreadManager;
import com.google.common.eventbus.Subscribe;

/**
 * 相关同步机器
 * @author zy
 *
 */
public class SlaveDevice {
	public String serial = null;
	private Stf stf = null;
	
	public SlaveDevice(String serial){
		this.serial = serial;
		stf = new Stf(serial);
	}
	
	public void startMiniTouch(){
		if(stf != null){
			stf.start();
		}
	}
	
	@Subscribe
	public void dealEvent(String cmdStr){
		ThreadManager.getInstance().start(()->{
			if(stf != null){
				stf.getMiniTouch().touchEvent(cmdStr);
				if(Config.Flag_Log){
					System.out.println(cmdStr);
				}
			}
		});
		
	}
	public static void main(String[] args) {
		SlaveDevice dd = new SlaveDevice("R4DEGAD6I7U4S4WO");
		dd.startMiniTouch();
	}

}
